import request from '@/utils/request'

const userApi = {
	Login: '/auth/login',
	Logout: '/auth/logout',
	ForgePassword: '/auth/forge-password',
	Register: '/auth/register',
	twoStepCode: '/auth/2step-code',
	SendSms: '/account/sms',
	SendSmsErr: '/account/sms_err',
	// get my info
	UserInfo: '/user/info',
	UserMenu: '/user/nav'
}

export function login(data) {
	return request({
		url: 'authority/v1/login',
		method: 'post',
		data
	})
}


export function getInfo(data) {
	return request({
		url: 'authority/v1/getUserInfo',
		method: 'get',
		params:data
		// headers: {
		// 	'Content-Type': 'application/json;charset=UTF-8'
		// }
	})
}

export function getCurrentUserNav() {
	return request({
		url: userApi.UserMenu,
		method: 'get'
	})
}

export function logout() {
	return new Promise((resolve, rejcet) => {
		setTimeout(() => {
			resolve()
		}, 100);
	})
}

/**
 * get user 2step code open?
 * @param parameter {*}
 */
export function get2step(parameter) {
	return request({
		url: userApi.twoStepCode,
		method: 'post',
		data: parameter
	})
}
